﻿using System.Collections.Generic;
using MadMediaManager.Core.Domain.Components;

namespace MadMediaManager.Core.Domain
{
    public class SoftwareIso : Iso
    {
        protected SoftwareIso()
        {
        }

        public static SoftwareIso NewIso(string filePath, string name, long fileSize)
        {
            return new SoftwareIso()
            {
                EntityId = filePath,
                FileSize = new DigitalInformationUnitValue(DigitalInformationUnit.Byte, fileSize),
                IsFileFound = true,
                Name = name,
                _licenses = new List<SoftwareLicense>()
            };
        }

        public virtual string Publisher { get; set; }
        public virtual string Version { get; set; }
        public virtual Architecture Architecture { get; set; }
        public virtual Platform Platform { get; set; }
        public virtual string ProductFamily { get; set; }

        protected IList<SoftwareLicense> _licenses;
        public virtual IEnumerable<SoftwareLicense> Licenses { get { return _licenses; } }

        public virtual void AddLicense(SoftwareLicense license)
        {
            license.SoftwareIso = this;
            _licenses.Add(license);
        }

        public virtual void RemoveLicense(SoftwareLicense license)
        {
            _licenses.Remove(license);
        }

        public override IsoType IsoType
        {
            get { return IsoType.Software; }
            set { }
        }
    }
}
